package com.srwl.mytx.domain;

import android.os.Parcel;
import android.os.Parcelable;

import java.math.BigDecimal;
import java.util.Date;

public class AdvertisementOrder implements Parcelable {
    private String id;

    private String uId;

    private String aId;

    private String title;

    private BigDecimal amount;

    private Date startDate;

    private Date endDate;

    private String video;

    private String picture;

    private String donationId;

    private BigDecimal donationAmount;

    public AdvertisementOrder(String id, String uId, String aId, String title, BigDecimal amount, Date startDate, Date endDate, String video, String picture, String donationId, BigDecimal donationAmount) {
        this.id = id;
        this.uId = uId;
        this.aId = aId;
        this.title = title;
        this.amount = amount;
        this.startDate = startDate;
        this.endDate = endDate;
        this.video = video;
        this.picture = picture;
        this.donationId = donationId;
        this.donationAmount = donationAmount;
    }

    public AdvertisementOrder() {
        super();
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getuId() {
        return uId;
    }

    public void setuId(String uId) {
        this.uId = uId == null ? null : uId.trim();
    }

    public String getaId() {
        return aId;
    }

    public void setaId(String aId) {
        this.aId = aId == null ? null : aId.trim();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getVideo() {
        return video;
    }

    public void setVideo(String video) {
        this.video = video == null ? null : video.trim();
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture == null ? null : picture.trim();
    }

    public String getDonationId() {
        return donationId;
    }

    public void setDonationId(String donationId) {
        this.donationId = donationId == null ? null : donationId.trim();
    }

    public BigDecimal getDonationAmount() {
        return donationAmount;
    }

    public void setDonationAmount(BigDecimal donationAmount) {
        this.donationAmount = donationAmount;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.uId);
        dest.writeString(this.aId);
        dest.writeString(this.title);
        dest.writeSerializable(this.amount);
        dest.writeLong(this.startDate != null ? this.startDate.getTime() : -1);
        dest.writeLong(this.endDate != null ? this.endDate.getTime() : -1);
        dest.writeString(this.video);
        dest.writeString(this.picture);
        dest.writeString(this.donationId);
        dest.writeSerializable(this.donationAmount);
    }

    protected AdvertisementOrder(Parcel in) {
        this.id = in.readString();
        this.uId = in.readString();
        this.aId = in.readString();
        this.title = in.readString();
        this.amount = (BigDecimal) in.readSerializable();
        long tmpStartDate = in.readLong();
        this.startDate = tmpStartDate == -1 ? null : new Date(tmpStartDate);
        long tmpEndDate = in.readLong();
        this.endDate = tmpEndDate == -1 ? null : new Date(tmpEndDate);
        this.video = in.readString();
        this.picture = in.readString();
        this.donationId = in.readString();
        this.donationAmount = (BigDecimal) in.readSerializable();
    }

    public static final Parcelable.Creator<AdvertisementOrder> CREATOR = new Parcelable.Creator<AdvertisementOrder>() {
        @Override
        public AdvertisementOrder createFromParcel(Parcel source) {
            return new AdvertisementOrder(source);
        }

        @Override
        public AdvertisementOrder[] newArray(int size) {
            return new AdvertisementOrder[size];
        }
    };
}